#ifndef EMDSTEG_H
#define EMDSTEG_H

#define mod(x,mod) ((x)%(mod)<0?((x)%(mod)+(mod))%(mod):(x)%(mod))
inline long long mmul ( long long a, long long b, const long long& Mod )  {
    long long lf = a * ( b >> 25LL ) % Mod * ( 1LL << 25 ) % Mod ;
    long long rg = a * ( b & ( ( 1LL << 25 ) - 1 ) ) % Mod ;
    return ( lf + rg ) % Mod ;
}

#include <QImage>
class EMDSteg
{
public:
    EMDSteg();
    ~EMDSteg(){};
public:
    QImage emdImbedded(const QByteArray &msg);
    QByteArray emdRetrieval();
    static void emdImbeddedInt(uchar *imaData, int msg, int &j);
    static int emdRetrievalInt(const uchar *imaData, int &j);
    static QByteArray emdRetrieval(const QImage& msg);
    static QByteArray emdRetrieval(QImage&& msg);
    static QByteArray emdRetrieval(const uchar* msg,int msg_len);
    static bool   emdImbedded(QImage &image , const QByteArray& msg);
    static bool   emdImbedded(uchar* image , int len, const QByteArray& msg);
    static QImage emdImbedded(const QImage &image , const QByteArray& msg);
    static QImage emdImbedded(QImage &&image,const QByteArray& msg);
private:
    QImage m_carrierIamge;
    static void empImbeddedANum(uchar* imaData,char data,int& j);
    static char emdRetrievalANum(const uchar* imaData,int& j);
    static std::string _2To5(int num);
    static QImage toGray( const QImage& image );
};

#endif // EMDSTEG_H
